Skip to content

Conversation

@brendt
Copy link
Member

@brendt brendt commented Dec 8, 2025

No description provided.

@innocenzi innocenzi changed the title feat(core): frankenphp worker mode feat(core): support frankenphp worker mode Dec 8, 2025
])->run();
];

if (function_exists('frankenphp_handle_request')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't be enough, as this method exists even when FrankenPHP is running in non-worker mode, and the call below to this method will throw an exception.

This would be a proper check:

Suggested change
if (function_exists('frankenphp_handle_request')) {
$isWorkerMode = $_SERVER['FRANKENPHP_WORKER'] ?? false;
if ($isWorkerMode && function_exists('frankenphp_handle_request')) {

@xHeaven
Copy link
Contributor

xHeaven commented Dec 12, 2025

I'm not sure this is the proper way to do this. The entire point of containerizing Tempest would be that the user don't need PHP on their system at all - so having to invoke the tempest binary is not exactly what we want here.

We could just ship with a Dockerfile:

FROM serversideup/php:8.5-frankenphp

USER root

RUN install-php-extensions intl ftp

USER www-data

WORKDIR /var/www/html

And then have 2 configurations, one in simple mode, one in worker mode:

x-volume: &app-volume .:/var/www/html

services:
  php:
    build: .
    container_name: tempest
    ports:
      - "80:8080"
      - "443:8443"
    volumes:
      - *app-volume
    environment:
      SSL_MODE: "mixed"
x-volume: &app-volume .:/var/www/html
x-worker: &worker-config "worker /var/www/html/public/index.php"

services:
  php:
    build: .
    container_name: tempest
    ports:
      - "80:8080"
      - "443:8443"
    volumes:
      - *app-volume
    environment:
      SSL_MODE: "mixed"
      FRANKENPHP_CONFIG: *worker-config

@aidan-casey
Copy link
Member

I am in agreement with @xHeaven here. This should be a simple Dockerfile that bundles the application and allows a worker mode + non-worker mode.

I'm not sure if this should be part of the framework so much as an application scaffold/package that can publish to the application.

@xHeaven
Copy link
Contributor

xHeaven commented Dec 12, 2025

I am in agreement with @xHeaven here. This should be a simple Dockerfile that bundles the application and allows a worker mode + non-worker mode.

I'm not sure if this should be part of the framework so much as an application scaffold/package that can publish to the application.

It could be an installable package like Sail for Laravel IMHO. We could also provide our own binary to run things as well (just like sail again), we could even call it dockest. 👀

Then you could do:

./dockest serve # simple server
./dockest serve --mode=worker # worker mode

@brendt
Copy link
Member Author

brendt commented Jan 5, 2026

@aidan-casey @xHeaven I'm super open for your feedback here as I'm a total noob in this area. My only goal is to get Tempest properly working with FrankenPHP worker mode, I'm totally fine with whatever approach.

The reason I briefly stopped working on this PR is because I ran into framework-specific errors that were impossible to read in worker-mode output.

I talked about it with Kevin Dunglas, who suggested writing errors to files and then tail them, but then I ran into not knowing how to do that with a Docker container 😅

Long story short: I could use some help :p

@innocenzi
Copy link
Member

Note: #1834 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants